using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RBAC.ErrorCode;
using RBAC.Domain.ProcurementManagement;
using RBAC.Read.Api.Application.Command.ProcurementOrderInfo;

namespace RBAC.Read.Api.Controllers
{
    /// <summary>
    /// 采购订单
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class ProcurementOrderReadController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProcurementOrderReadController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 采购订单列表
        /// </summary>
        [HttpGet]
        public Task<APIResult<APIPaging<ProcurementTable>>> GetList([FromQuery] GetProcurementOrderCommands request, CancellationToken cancellationToken)
        {
            return mediator.Send(request, cancellationToken);
        }
    }
}
